package com.easy.controller;

import com.easy.common.CommonResult;
import com.easy.config.ImgStaticPathConfig;
import com.easy.utils.UploadFileUtil;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@RestController
public class ImgController {

    @PostMapping("img")
    public CommonResult staffImg(@RequestParam("file") MultipartFile file){
        System.out.println(file);
        //存储文件
        String newName = UploadFileUtil.uploadfile(file);
        //返回上传文件的地址
        return CommonResult.success(ImgStaticPathConfig.STATIC_PATH + newName);
    }
}
